package com.swf.common.fmt;

import java.io.*;
import java.util.*;

import org.dom4j.*;

import com.swf.common.base.*;
import com.swf.common.utils.*;
import com.swf.common.xml.*;

public class XmlIColl {
	private String dataName;
	private String tagName;
	private List<XmlWrap> xmlWrapList = new ArrayList<XmlWrap>();

	public String getDataName() {
		return dataName;
	}

	public void setDataName(String dataName) {
		this.dataName = dataName;
	}

	public String getTagName() {
		return tagName;
	}

	public void setTagName(String tagName) {
		this.tagName = tagName;
	}

	public List<XmlWrap> getXmlWrapList() {
		return xmlWrapList;
	}

	public void setXmlWrapList(List<XmlWrap> xmlWrapList) {
		this.xmlWrapList = xmlWrapList;
	}

	public void addXmlWrap(XmlWrap xmlWrap) {
		this.xmlWrapList.add(xmlWrap);
	}

	public void removeXmlWrap(XmlWrap xmlWrap) {
		this.xmlWrapList.remove(xmlWrap);
	}

	public String toString() {
		StringBuffer sb = new StringBuffer();
		sb.append("<xmlIColl dataName=\"" + this.dataName + "\" tagName=\""
				+ this.tagName + "\">");
		for (XmlWrap xmlWrap : xmlWrapList) {
			sb.append(xmlWrap.toString());
		}
		sb.append("</xmlIColl>");
		return sb.toString();
	}

	public String toFormatString() {
		try {
			return FwsXmlUtils.formatPrettyXmlWithOutEncoding(toString());
		} catch (DocumentException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
		return null;
	}
}